package com.lyt.springboot.controller;

import com.lyt.springboot.diffHandler.ActionHandler;
import com.lyt.springboot.diffHandler.ActionMethodContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ActionController {

    @Autowired
    ActionMethodContext actionMethodContext;

    @GetMapping("/action")
    public String doAction(String actionMethod){
        ActionHandler actionHandler = actionMethodContext.getActionMethod(actionMethod);
        String result = (String) actionHandler.handler();
        return result;
    }

}

